﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Module;
using DLL;
using System.Data.SqlClient;

namespace BLL
{
    public class BUserPaperTag
    {
        #region 字段

        private DUserPaperTag APP = new DUserPaperTag();//数据操作对象
        private static BUserPaperTag instance;

        #endregion

        #region 公共接口
        /// <summary>
        /// 取得
        /// </summary>
        /// <returns>BUserPaperTag对象</returns>
        public static BUserPaperTag getInstance()
        {
            if (instance == null)
            {
                instance = new BUserPaperTag();
            }
            return instance;
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="userPaperTagInfo"></param>
        /// <returns></returns>
        public bool Insert(UserPaperTagInfo userPaperTagInfo)
        {
            if (userPaperTagInfo == null || userPaperTagInfo.UserPaperTagId == 0)
                return false;
            return APP.Insert(userPaperTagInfo);
        }
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="paperInfo"></param>
        /// <returns></returns>
        public bool Update(UserPaperTagInfo userPaperTagInfo)
        {
            if (userPaperTagInfo == null || userPaperTagInfo.UserPaperTagId == 0)
                return false;
            return APP.Update(userPaperTagInfo);
        }
        /// <summary>
        /// 根据PagerId和TagId删除
        /// </summary>
        /// <param name="userPaperId"></param>
        /// <param name="tagId"></param>
        /// <returns></returns>
        public int Delete(long userPaperId, long tagId)
        {
            if (userPaperId == 0 || tagId == 0)
                return 0;
            return APP.Delete(userPaperId, tagId);

        }

        /// <summary>
        /// 根据PagerId删除
        /// </summary>
        /// <param name="userPaperId"></param>
        /// <returns></returns>
        public int Delete(long userPaperId)
        {
            if (userPaperId == 0)
                return 0;
            return APP.Delete(userPaperId);
        }
        /// <summary>
        /// 根据主键删除
        /// </summary>
        /// <param name="userPaperTagId"></param>
        /// <returns></returns>
        public int DeleteById(long userPaperTagId)
        {
            if (userPaperTagId == 0)
                return 0;
            return APP.DeleteById(userPaperTagId);
        }

        /// <summary>
        /// 批量插入
        /// </summary>
        /// <param name="paperTagInfos"></param>
        /// <returns></returns>
        public bool Insert(List<UserPaperTagInfo> paperTagInfos)
        {
            if (paperTagInfos == null || paperTagInfos.Count == 0)
                return false;
            return APP.Insert(paperTagInfos);

        }

         /// <summary>
        /// 事物中批量插入
        /// </summary>
        /// <param name="paperTagInfos"></param>
        /// <param name="trans"></param>
        /// <returns></returns>
        public bool Insert(List<UserPaperTagInfo> paperTagInfos, SqlTransaction trans)
        {
            if (paperTagInfos == null || paperTagInfos.Count == 0 || trans == null)
                return false;
            return APP.Insert(paperTagInfos, trans);

        }
        #endregion
    }
}
